package com.yuandengta.yomall.member.web;

import com.yuandengta.common.utils.JsonUtils;
import com.yuandengta.common.utils.R;
import com.yuandengta.yomall.member.feign.OrderFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

/**
 * 会员服务 {@link MemberWebController}
 *
 * @author Kevin
 * @email: 178676392@qq.com
 */
@Controller
public class MemberWebController {

    @Autowired
    private OrderFeignService orderFeignService;

    /**
     * 会员订单列表页
     * @param pageNum
     * @param model
     * @return
     */
    @GetMapping("/memberOrder.html")
    public String memberOrderPage(@RequestParam(value = "pageNum", defaultValue = "1") String pageNum,
                                  Model model){
        Map<String, Object> params = new HashMap<>(1);
        params.put("page", pageNum);
        R r = orderFeignService.listWithItem(params);
        model.addAttribute("orders", r);

        return "orderList";
    }
}
